#pragma warning(disable : 4996)
#include<stdio.h>
#include<stdlib.h>
int size;
struct student
{
	int id[100] ;
	int sc1[100];
	int sc2[100];
	int av[100];
};


int main()
{
	struct student st[10]={0};
	FILE *outfile;
	if ((outfile = fopen("text.dat", "w")) == NULL)
	{
		printf("Failed to open\n");
		exit(100);
	}
	printf("请输入考生数量：\n");
	scanf_s("%d", &size);
	printf("请输入考生信息，用逗号隔开（样例：学号，成绩，成绩）\n");
	fputs("      成绩登记表      \n",outfile);
	for (int i = 0; i < size; i++)
	{
		scanf("%d,%d,%d" , st[i].id,st[i].sc1,st[i].sc2);
	    st[i].av= ( st[i].sc1+st[i].sc2 ) / 2;
		fprintf(outfile, "%d,%d,%d,%d\n", st[i].id, st[i].sc1, st[i].sc2,st[i].av);
	}
	fclose(outfile);
	return 0;
}